#ifndef WIDGET_FUNCC_SMART_HOME_H
#define WIDGET_FUNCC_SMART_HOME_H

#include <QWidget>
#include <QCamera>
#include <QCameraViewfinder>
#include <QCameraImageCapture>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QImage>
#include <QPixmap>
#include <QLabel>

class Widget_funcC_Smart_Home : public QWidget
{
    Q_OBJECT

public:
    explicit Widget_funcC_Smart_Home(QWidget *parent = nullptr);
    ~Widget_funcC_Smart_Home();

private slots:
    void toggleCamera();       // 开启/关闭摄像头
    void captureImage();       // 捕获图片
    void rotateImage();        // 旋转图片
    void flipImage();          // 镜像翻转
    void grayscaleImage();     // 灰度化
    void resetImage();         // 重置图片

private:
    void initCameraUI();       // 初始化摄像头界面
    void initTransformUI();    // 初始化图片变换按钮

    QCamera *camera;
    QCameraViewfinder *viewfinder;
    QCameraImageCapture *imageCapture;
    QPushButton *startButton;
    QPushButton *captureButton;
    QPushButton *rotateButton;
    QPushButton *flipButton;
    QPushButton *grayscaleButton;
    QPushButton *resetButton;
    QLabel *imageLabel;        // 用于显示捕获的图片
    QPixmap currentPixmap;     // 当前处理的图片

    bool isCameraOn = false;   // 摄像头状态
};

#endif // WIDGET_FUNCC_SMART_HOME_H
